/**
 * This is a generated class and is not intended for modfication.  To customize behavior
 * of this value object you may modify the generated sub-class of this class - Item.as.
 */

package valueObjects
{
import com.adobe.fiber.services.IFiberManagingService;
import com.adobe.fiber.valueobjects.IValueObject;
import flash.events.Event;
import flash.events.EventDispatcher;
import mx.collections.ArrayCollection;
import mx.events.PropertyChangeEvent;
import valueObjects.Item;

import flash.net.registerClassAlias;
import flash.net.getClassByAlias;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;

use namespace model_internal;

[ExcludeClass]
public class _Super_Item extends flash.events.EventDispatcher implements com.adobe.fiber.valueobjects.IValueObject
{
    model_internal static function initRemoteClassAliasSingle(cz:Class) : void 
    {
    }   
     
    model_internal static function initRemoteClassAliasAllRelated() : void 
    {
        valueObjects.Item.initRemoteClassAliasSingleChild();
    }

	model_internal var _dminternal_model : _ItemEntityMetadata;

	/**
	 * properties
	 */
	private var _internal_list : String;
	private var _internal_item : ArrayCollection;
	model_internal var _internal_item_leaf:valueObjects.Item;
	private var _internal_cid : Number;
	private var _internal_delist_time : Date;
	private var _internal_nick : String;
	private var _internal_num_iid : int;
	private var _internal_pic_url : String;
	private var _internal_post_fee : String;
	private var _internal_price : int;
	private var _internal_score : String;
	private var _internal_title : String;
	private var _internal_type : String;
	private var _internal_volume : String;

    private static var emptyArray:Array = new Array();

    /**
     * derived property cache initialization
     */  
    model_internal var _cacheInitialized_isValid:Boolean = false;   
    
	model_internal var _changeWatcherArray:Array = new Array();   

	public function _Super_Item() 
	{	
		_model = new _ItemEntityMetadata(this);
	
		// Bind to own data properties for cache invalidation triggering  
       
	}

    /**
     * data property getters
     */
	[Bindable(event="propertyChange")] 
    public function get list() : String    
    {
            return _internal_list;
    }    
	[Bindable(event="propertyChange")] 
    public function get item() : ArrayCollection    
    {
            return _internal_item;
    }    
	[Bindable(event="propertyChange")] 
    public function get cid() : Number    
    {
            return _internal_cid;
    }    
	[Bindable(event="propertyChange")] 
    public function get delist_time() : Date    
    {
            return _internal_delist_time;
    }    
	[Bindable(event="propertyChange")] 
    public function get nick() : String    
    {
            return _internal_nick;
    }    
	[Bindable(event="propertyChange")] 
    public function get num_iid() : int    
    {
            return _internal_num_iid;
    }    
	[Bindable(event="propertyChange")] 
    public function get pic_url() : String    
    {
            return _internal_pic_url;
    }    
	[Bindable(event="propertyChange")] 
    public function get post_fee() : String    
    {
            return _internal_post_fee;
    }    
	[Bindable(event="propertyChange")] 
    public function get price() : int    
    {
            return _internal_price;
    }    
	[Bindable(event="propertyChange")] 
    public function get score() : String    
    {
            return _internal_score;
    }    
	[Bindable(event="propertyChange")] 
    public function get title() : String    
    {
            return _internal_title;
    }    
	[Bindable(event="propertyChange")] 
    public function get type() : String    
    {
            return _internal_type;
    }    
	[Bindable(event="propertyChange")] 
    public function get volume() : String    
    {
            return _internal_volume;
    }    

    /**
     * data property setters
     */      
    public function set list(value:String) : void 
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_list == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:String = _internal_list;               
        if (oldValue !== value)
        {
            _internal_list = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "list", oldValue, _internal_list));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set item(value:*) : void
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_item == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:ArrayCollection = _internal_item;               
        if (oldValue !== value)
        {
            if (value is ArrayCollection)
            {
                _internal_item = value;
            }
            else if (value is Array)
            {
                _internal_item = new ArrayCollection(value);
            }
            else
            {
                throw new Error("value of item must be a collection");
            }
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "item", oldValue, _internal_item));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set cid(value:Number) : void 
    {    	
        var recalcValid:Boolean = false;
    	
    	
    	var oldValue:Number = _internal_cid;               
        if (oldValue !== value)
        {
            _internal_cid = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "cid", oldValue, _internal_cid));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set delist_time(value:Date) : void 
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_delist_time == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:Date = _internal_delist_time;               
        if (oldValue !== value)
        {
            _internal_delist_time = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "delist_time", oldValue, _internal_delist_time));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set nick(value:String) : void 
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_nick == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:String = _internal_nick;               
        if (oldValue !== value)
        {
            _internal_nick = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "nick", oldValue, _internal_nick));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set num_iid(value:int) : void 
    {    	
        var recalcValid:Boolean = false;
    	
    	
    	var oldValue:int = _internal_num_iid;               
        if (oldValue !== value)
        {
            _internal_num_iid = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "num_iid", oldValue, _internal_num_iid));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set pic_url(value:String) : void 
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_pic_url == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:String = _internal_pic_url;               
        if (oldValue !== value)
        {
            _internal_pic_url = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "pic_url", oldValue, _internal_pic_url));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set post_fee(value:String) : void 
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_post_fee == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:String = _internal_post_fee;               
        if (oldValue !== value)
        {
            _internal_post_fee = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "post_fee", oldValue, _internal_post_fee));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set price(value:int) : void 
    {    	
        var recalcValid:Boolean = false;
    	
    	
    	var oldValue:int = _internal_price;               
        if (oldValue !== value)
        {
            _internal_price = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "price", oldValue, _internal_price));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set score(value:String) : void 
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_score == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:String = _internal_score;               
        if (oldValue !== value)
        {
            _internal_score = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "score", oldValue, _internal_score));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set title(value:String) : void 
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_title == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:String = _internal_title;               
        if (oldValue !== value)
        {
            _internal_title = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "title", oldValue, _internal_title));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set type(value:String) : void 
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_type == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:String = _internal_type;               
        if (oldValue !== value)
        {
            _internal_type = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "type", oldValue, _internal_type));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    
    public function set volume(value:String) : void 
    {    	
        var recalcValid:Boolean = false;
    	if (value == null || _internal_volume == null)
    	{
    		recalcValid = true;
    	}	
    	
    	
    	var oldValue:String = _internal_volume;               
        if (oldValue !== value)
        {
            _internal_volume = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "volume", oldValue, _internal_volume));
        }    	     
        
        if (recalcValid && model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }  
    }    

    /**
     * data property setter listeners
     */   

   model_internal function setterListenerAnyConstraint(value:flash.events.Event):void
   {
        if (model_internal::_cacheInitialized_isValid)
        {
            model_internal::isValid_der = model_internal::calculateIsValid();
        }        
   }   

    /**
     * valid related derived properties
     */
    model_internal var _isValid : Boolean;
    model_internal var _invalidConstraints:Array = new Array();
    model_internal var _validationFailureMessages:Array = new Array();

    /**
     * derived property calculators
     */

    /**
     * isValid calculator
     */
    model_internal function calculateIsValid():Boolean
    {
        var violatedConsts:Array = new Array();    
        var validationFailureMessages:Array = new Array();    

		if (_model.isListAvailable && _internal_list == null)
		{
			violatedConsts.push("listIsRequired");
			validationFailureMessages.push("list is required");
		}
		if (_model.isItemAvailable && _internal_item == null)
		{
			violatedConsts.push("itemIsRequired");
			validationFailureMessages.push("item is required");
		}
		if (_model.isDelist_timeAvailable && _internal_delist_time == null)
		{
			violatedConsts.push("delist_timeIsRequired");
			validationFailureMessages.push("delist_time is required");
		}
		if (_model.isNickAvailable && _internal_nick == null)
		{
			violatedConsts.push("nickIsRequired");
			validationFailureMessages.push("nick is required");
		}
		if (_model.isPic_urlAvailable && _internal_pic_url == null)
		{
			violatedConsts.push("pic_urlIsRequired");
			validationFailureMessages.push("pic_url is required");
		}
		if (_model.isPost_feeAvailable && _internal_post_fee == null)
		{
			violatedConsts.push("post_feeIsRequired");
			validationFailureMessages.push("post_fee is required");
		}
		if (_model.isScoreAvailable && _internal_score == null)
		{
			violatedConsts.push("scoreIsRequired");
			validationFailureMessages.push("score is required");
		}
		if (_model.isTitleAvailable && _internal_title == null)
		{
			violatedConsts.push("titleIsRequired");
			validationFailureMessages.push("title is required");
		}
		if (_model.isTypeAvailable && _internal_type == null)
		{
			violatedConsts.push("typeIsRequired");
			validationFailureMessages.push("type is required");
		}
		if (_model.isVolumeAvailable && _internal_volume == null)
		{
			violatedConsts.push("volumeIsRequired");
			validationFailureMessages.push("volume is required");
		}

		var styleValidity:Boolean = true;
	
	
	
	
	
	
	
	
	
	
	
	
	
    
        model_internal::_cacheInitialized_isValid = true;
        model_internal::invalidConstraints_der = violatedConsts;
        model_internal::validationFailureMessages_der = validationFailureMessages;
        return violatedConsts.length == 0 && styleValidity;
    }  

    /**
     * derived property setters
     */

    model_internal function set isValid_der(value:Boolean) : void
    {
       	var oldValue:Boolean = model_internal::_isValid;               
        if (oldValue !== value)
        {
        	model_internal::_isValid = value;
        	_model.model_internal::fireChangeEvent("isValid", oldValue, model_internal::_isValid);
        }        
    }

    /**
     * derived property getters
     */

    [Transient] 
	[Bindable(event="propertyChange")] 
    public function get _model() : _ItemEntityMetadata
    {
		return model_internal::_dminternal_model;              
    }	
    
    public function set _model(value : _ItemEntityMetadata) : void       
    {
    	var oldValue : _ItemEntityMetadata = model_internal::_dminternal_model;               
        if (oldValue !== value)
        {
        	model_internal::_dminternal_model = value;
        	this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "_model", oldValue, model_internal::_dminternal_model));
        }     
    }      

    /**
     * methods
     */  


    /**
     *  services
     */                  
     private var _managingService:com.adobe.fiber.services.IFiberManagingService;
    
     public function set managingService(managingService:com.adobe.fiber.services.IFiberManagingService):void
     {
         _managingService = managingService;
     }                      
     
    model_internal function set invalidConstraints_der(value:Array) : void
    {  
     	var oldValue:Array = model_internal::_invalidConstraints;
     	// avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_invalidConstraints = value;   
			_model.model_internal::fireChangeEvent("invalidConstraints", oldValue, model_internal::_invalidConstraints);   
        }     	             
    }             
    
     model_internal function set validationFailureMessages_der(value:Array) : void
    {  
     	var oldValue:Array = model_internal::_validationFailureMessages;
     	// avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_validationFailureMessages = value;   
			_model.model_internal::fireChangeEvent("validationFailureMessages", oldValue, model_internal::_validationFailureMessages);   
        }     	             
    }        
     
     // Individual isAvailable functions     
	// fields, getters, and setters for primitive representations of complex id properties

}

}
